﻿using System;
using DAL;
using VO;
using COMMON;

namespace BLL
{
    public class StatusAtendimentoBLL
    {

        #region Insert
        public static Retorno<StatusAtendimento> Insert(StatusAtendimento obj)
        {
            var objReturn = new Retorno<StatusAtendimento>();
            try
            {
                //Insere Status
                new StatusAtendimentoDAL().Insert(obj);
                objReturn.Error = Enumerator.Error.Success;
                objReturn.Message = "OK";
            }
            catch (Exception ex)
            {
                objReturn.Error = Enumerator.Error.Failed;
                objReturn.Message = ex.Message;
            }
            return objReturn;
        }
        #endregion

        #region Update
        public static Retorno<StatusAtendimento> Update(StatusAtendimento obj)
        {
            var objReturn = new Retorno<StatusAtendimento>();
            try
            {
                //Altera Status
                new StatusAtendimentoDAL().Update(obj);
                objReturn.Error = Enumerator.Error.Success;
                objReturn.Message = "OK";
            }
            catch (Exception ex)
            {
                objReturn.Error = Enumerator.Error.Failed;
                objReturn.Message = ex.Message;
            }
            return objReturn;
        }
        #endregion

        #region UpdateStatus
        public static Retorno<StatusAtendimento> UpdateStatus(StatusAtendimento obj)
        {
            var objReturn = new Retorno<StatusAtendimento>();
            try
            {
                //Altera Status
                new StatusAtendimentoDAL().UpdateStatus(obj);
                objReturn.Error = Enumerator.Error.Success;
                objReturn.Message = "OK";
            }
            catch (Exception ex)
            {
                objReturn.Error = Enumerator.Error.Failed;
                objReturn.Message = ex.Message;
            }
            return objReturn;
        }
        #endregion

        #region Delete
        public static Retorno<StatusAtendimento> Delete(int idStatus)
        {
            var objReturn = new Retorno<StatusAtendimento>();
            try
            {
                //Deleta Status
                new StatusAtendimentoDAL().Delete(idStatus);
                objReturn.Error = Enumerator.Error.Success;
                objReturn.Message = "OK";
            }
            catch (Exception ex)
            {
                objReturn.Error = Enumerator.Error.Failed;
                objReturn.Message = ex.Message;
            }
            return objReturn;
        }
        #endregion

        #region Select
        public static Retorno<StatusAtendimento> Select(string nomeStatus = "")
        {
            var objReturn = new Retorno<StatusAtendimento>();
            try
            {
                //Lista Campanha
                objReturn.List = new StatusAtendimentoDAL().Select(nomeStatus);
                objReturn.Error = Enumerator.Error.Success;
                objReturn.Message = "OK";
            }
            catch (Exception ex)
            {
                objReturn.Error = Enumerator.Error.Failed;
                objReturn.Message = ex.Message;
            }
            return objReturn;
        }

        public static Retorno<StatusAtendimento> Select(int idStatus)
        {
            var objReturn = new Retorno<StatusAtendimento>();
            try
            {
                //Lista Campanha
                objReturn.List = new StatusAtendimentoDAL().Select(idStatus);
                objReturn.Error = Enumerator.Error.Success;
                objReturn.Message = "OK";
            }
            catch (Exception ex)
            {
                objReturn.Error = Enumerator.Error.Failed;
                objReturn.Message = ex.Message;
            }
            return objReturn;
        }
        #endregion

    }
}